package org.jash.sportnews2109.vm

import androidx.lifecycle.MutableLiveData
import org.jash.common.mvvm.BaseViewModel
import java.util.Timer
import java.util.TimerTask

class SplashViewModel:BaseViewModel() {
    val countLiveData by lazy{ MutableLiveData<Int>() }
    fun start(count:Int) {
        var c = count
        val timer = Timer()
        timer.schedule(object :TimerTask(){
            override fun run() {
                countLiveData.postValue(c--)
                if (c < 0) {
                    timer.cancel()
                }
            }
        }, 0L, 1000L)
    }
}